﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace Tin
{
    class FileManager
    {
        public static void FileOpen(string path, out List<TPoint> points, out double height)
        {
            using (var reader = new StreamReader(path))
            {
                string line = reader.ReadLine();
                height = Convert.ToDouble(line.Split(',')[1]);
                reader.ReadLine();
                points = new List<TPoint>();
                int i = 1;
                while ((line=reader.ReadLine())!=null)
                {
                    string[] strs = line.Split(',');
                    double x = Convert.ToDouble(strs[1]);
                    double y = Convert.ToDouble(strs[2]);
                    double z = Convert.ToDouble(strs[3]);
                    TPoint t = new TPoint(i, strs[0], x, y, z);
                    points.Add(t);
                }
            }
        }
    }
}
